package cn.sunxyz.spider.sample.zhihu;

import cn.sunxyz.spider.Spider;

import java.util.stream.Stream;

/**
 * Created by yangrd on 2018/6/14
 **/
public class SpiderZhiHuPipelineDemo {


    /**
     * 自己定义 抓取的url链接
     */
    public void initStreamDemo() {
        String url = "https://www.zhihu.com/question/";
        Stream<String> urlStream = Stream.iterate(28629300, i -> i + 1).limit(60).map(i -> url + i).parallel();
        new Spider() {{
                pipeline = new ZhiHuPipeline();
        }}.init(urlStream).start();
    }
}
